package com.xoa.controller.knowledge;

import com.xoa.model.knowledge.KnowledgeCustomer;
import com.xoa.model.knowledge.KnowledgeRoleColumn;
import com.xoa.service.knowledge.ClientService;
import com.xoa.service.knowledge.RoleColumnService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 知识库-角色管理控制器
 */
@Controller
@RequestMapping("/clientRole")
public class ClientRoleContraller {
    @Autowired
    private RoleColumnService roleColumnService;

    /**
     * 知识库-角色管理页面映射
     */
    @RequestMapping("/clientRoleIndex")
    public String toClientIndex() { return "/app/knowledge/clientRole/clientRole"; }


    /**
     * 知识库-角色管理 查询所有角色
     * @param roleColumn
     * @return
     */
    @RequestMapping("/getAllRoleColumn")
    @ResponseBody
    public ToJson getAllRole(HttpServletRequest request,KnowledgeRoleColumn roleColumn, Integer page, Integer limit){
        return roleColumnService.getAllRole(request,roleColumn,page,limit);
    }
    /**
     * 知识库-客户管理 根据id查询
     * @param
     * @return
     */
    @RequestMapping("/getRoleById")
    @ResponseBody
    public ToJson getRoleById(Integer roleId){
        return roleColumnService.getRoleById(roleId);
    }

    @RequestMapping("/addRole")
    @ResponseBody
    public ToJson addRole(String json){
        return roleColumnService.addRole(json);
    }

    @RequestMapping("/delRole")
    @ResponseBody
    public ToJson delRole(String ids){
        return roleColumnService.delRole(ids);
    }

    @RequestMapping("/editRole")
    @ResponseBody
    public ToJson editRole(KnowledgeRoleColumn roleColumn){
        return roleColumnService.editRole(roleColumn);
    }

}
